let utils = require('../../utils/utils.js')

Page({

    /**
     * Page initial data
     */
    data: {
        veriyCode: "123456",
        location: [],
        phone: "19999999999",
    },

    //登录
    login() {
        wx.request({
            url: 'https://xinai.icu/api/login/mobile',
            method: 'POST',
            data: {
                inviteType: 0,
                mobile: "19999999999",
                verificationCode: "123456"
            },
            success(res) {
                let token = res.data.data.cookie;
                console.log("登录token: ", token)
                wx.setStorageSync("userInfo", {
                    phone: "19999999999",
                    token: token,
                });
                utils.getCallBackUrl().catch(() => {
                    wx.redirectTo({
                        url: '/pages/index/index'
                    })
                });
            },
            fail(err) {
                utils.toast("登录异常～");
            }
        });
    },
    //发送验证码
    send() {

    },

})